﻿using MediatR;
using T.Vehicleservice.Domain.T.Vehicleservice.Model;
using T.Vehicleservice.Read.API.Application.Command.MaintenanceRecordCommand;
using T.Vehicleservice.Repository.Interface;

namespace T.Vehicleservice.Read.API.Application.CommandHandlers.MaintenanceRecordHandlerCommand
{
    public class MainBackfillHandlerCommand : IRequestHandler<MainBackfillCommand, MaintenanceRecord>
    {
        protected readonly IMainIRepository mainIRepository;

        public MainBackfillHandlerCommand(IMainIRepository mainIRepository)
        {
            this.mainIRepository = mainIRepository;
        }

        public async Task<MaintenanceRecord> Handle(MainBackfillCommand request, CancellationToken cancellationToken)
        {
            return await mainIRepository.GetModelAsync(request.MaintenanceId);
        }
    }
}
